<!--
 * @Author: zhw
 * @Date: 2025-08-14 23:15:58
 * @LastEditTime: 2025-08-14 23:15:58
 * @LastEditors: zhw 443844039@qq.com
 * @Description: 督察评价
-->
<template>
  <div class="pageList">
    <TheTable
      ref="TheTableRef"
      :tableApi="evaluationListApi"
      :searchList="searchList"
			:listColumns="listColumns"
			:actionArr="actionArr"
			:btnList="btnList"
      :mustQuery="mustQuery"
      exportUrl='/jsjx/supervisorEvaluation/export'
      exportName="督察评价"
			@handleClick="handleClick"
    />
  </div>
</template>
<script>
import TheTable from '@/componentsView/TheTable.vue';
import { searchList, listColumns, actionArr, btnList} from './data'
import { evaluationListApi, evaluationDelApi } from '@/api/intelligentEvaluation/index'
export default {
  name: 'SupervisorList',
  components: { TheTable },
  data() {
    return {
      evaluationListApi,
      evaluationDelApi,
      searchList,
      listColumns,
      actionArr,
      btnList,
      mustQuery:{
        evaluationTypeId: '192'
      }
    }
  },

  methods: {
    setTableList(){
      this.$refs.TheTableRef.resetQuery()
    },
    handleClick({record,action}){
      let path = '';
      switch(action) {
        case 'add':
          path = '/intelligentEvaluation/supervisor/detail?action='+action;
          this.$router.push(path);
          break;
        case 'look':
        case 'edit':
          path = '/intelligentEvaluation/supervisor/detail?evaluationId=' + record.evaluationId + '&action='+ action;
          this.$router.push(path);
          break;
        case 'del':
          this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.delFun(record.evaluationId);
          }).catch(() => {
            this.$message.info('已取消删除');
          });
          break;
        default:
          break;
      }
    },
    delFun(evaluationId) {
      evaluationDelApi(evaluationId).then(res=>{
        if (res.code === 200) {
          this.$message.success(res.msg)
          this.setTableList()
        } else {
          this.$message.error(res.msg)
        }
      })
    }
  },
}
</script>
